import axios from "axios"
import cookie from 'js-cookie'

//创建axios实例
const service = axios.create({
  baseURL: "http://localhost:9001",
  timeout: 20000
})

//添加拦截器
service.interceptors.request.use(
  config=>{
    if(cookie.get("token")){
      config.headers['token'] = cookie.get('token')
    }
    return config
  },
  err => {
    return Promise.reject(err)
  }
)
export default service
